//
//  GYHomeVC.m
//  GYDemo
//
//  Created by mac on 2018/3/22.
//  Copyright © 2018年 mac. All rights reserved.
//

//
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                  \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
//
//

#import "GYHomeVC.h"
#import "Head.h"
#import "GYFinishRegisterVC.h"
#import "GYHomeBuyListVC.h"
#import "GYHomeMarketPriceVC.h"
#import "GY_NewMarketCenterVC.h"
#import "GYHomeBuyDetailVC.h"
#import "GYCartVC.h"
#import "GYHomeSaleDetailVC.h"
#import "GYSearchVC.h"

#import "NNSaleListCell.h"


#import "GYNewShopListVC.h"
#import "GYNewShopTypeViewModel.h"
#import "GYHomeTypeCollectView.h"
#import "GYMarketCenterListVC.h"
#import "GYNNSaleListVC.h"
@interface GYHomeVC ()<UITableViewDataSource,UITableViewDelegate,SDCycleScrollViewDelegate>
{
    UIButton *btnrr;
}
@property(nonatomic,strong)GYHomeSaleViewModel* saleViewModel;
@property(nonatomic,strong)GYHomeBuyViewModel* buyViewModel;
@property(nonatomic,strong)GYHomeMarketViewModel* marketViewModel;
@property(nonatomic,strong)GYHomeTopViewModel* topViewModel;
@property(nonatomic,strong)GYHomeAdViewModel* adViewModel;


@property(nonatomic,strong)GYNewShopTypeViewModel* typeViewModel;
@property(nonatomic,strong)GYHomeTypeCollectView* typeCollectView;
@end

@implementation GYHomeVC
#pragma mark - getter and setter
-(GYHomeTypeCollectView *)typeCollectView
{
    if (!_typeCollectView) {
        @WeakSelf;
        _typeCollectView=[[GYHomeTypeCollectView alloc] initWithFrame:WFCGRectMake(0, 0, 375, 500)];
        _typeCollectView.height=0;
        _typeCollectView.backHandler = ^(NSString *typeID) {
            GYNewShopListVC* gy=[[GYNewShopListVC alloc] init];
            gy.typeID=typeID;
            [selfp.navigationController pushViewController:gy animated:YES];

        };
    }
    return _typeCollectView;
}
-(GYNewShopTypeViewModel *)typeViewModel
{
    if (!_typeViewModel) {
        _typeViewModel=[[GYNewShopTypeViewModel alloc] init];
    }
    return _typeViewModel;
}

-(GYHomeAdViewModel *)adViewModel
{
    if (!_adViewModel) {
        _adViewModel=[[GYHomeAdViewModel alloc] init];
    }
    return _adViewModel;
}
-(GYHomeMarketViewModel *)marketViewModel
{
    if (!_marketViewModel) {
        _marketViewModel=[[GYHomeMarketViewModel alloc] init];
    }
    return _marketViewModel;
}
-(GYHomeTopViewModel *)topViewModel
{
    if (!_topViewModel) {
        _topViewModel=[[GYHomeTopViewModel alloc] init];
    }
    return _topViewModel;
}
-(GYHomeSaleViewModel *)saleViewModel
{
    if (!_saleViewModel) {
        _saleViewModel=[[GYHomeSaleViewModel alloc] init];
    }
    return _saleViewModel;
}
-(GYHomeBuyViewModel *)buyViewModel
{
    if (!_buyViewModel) {
        _buyViewModel=[[GYHomeBuyViewModel alloc] init];
    }
    return _buyViewModel;
}
#pragma mark - event
-(void)moreBtnPress:(UIButton*)sender
{
    NSLog(@"-----%ld",sender.tag);
    [self pushVC:sender.tag==2?@"100":sender.tag==3?@"101":sender.tag==4?@"102":sender.tag==5?@"104":@"101" type:3];
}
#pragma mark - method'

-(void)pushVC:(NSString* )str type:(NSInteger)type
{
    
    if (type==1)
    {
        GYHomeSaleDetailVC* gy=[[GYHomeSaleDetailVC alloc] init];
        gy.passID=str;
        gy.hidesBottomBarWhenPushed=YES;
        [self.navigationController pushViewController:gy animated:YES];
//        GYHomeWeb* gy=[[GYHomeWeb alloc] init];
//        gy.information=@{@"url":str};
//        [self.navigationController pushViewController:gy animated:YES];
    }
    
    if (type==2)
    {
        GYHomeMarketPriceVC* gy=[[GYHomeMarketPriceVC alloc] init];
        [self.navigationController pushViewController:gy animated:YES];
    }
    
    if (type==3)
    {
        switch ([str integerValue]) {
            case 100:
            {

                GYNNSaleListVC* gy=[[GYNNSaleListVC alloc] init];
                [self.navigationController pushViewController:gy animated:YES];
            }
                break;
                
            case 101:
            {
                GYHomeBuyListVC* gy=[[GYHomeBuyListVC alloc] init];
                [self.navigationController pushViewController:gy animated:YES];
            }
                break;
            case 102:
            {
                GYMarketCenterListVC* gy=[[GYMarketCenterListVC alloc] init];
                [self.navigationController pushViewController:gy animated:YES];
            }
                break;

            default:
                break;
        }
    }
}

-(void)setNavBG
{
    float contentY=self.baseTable.contentOffset.y;
    
    [self.navigationController.navigationBar setBackgroundImage:[WFFunctions WFUICreateImageWithColor:RGBACOLOR(184,26,8,contentY>GY_Nav_height?1:0)] forBarMetrics:UIBarMetricsDefault];
    [UIApplication sharedApplication].statusBarStyle = contentY>GY_Nav_height?UIStatusBarStyleLightContent:UIStatusBarStyleDefault;
    [btnrr setTitleColor:contentY>64?[UIColor whiteColor]:[UIColor whiteColor] forState:UIControlStateNormal];

}
-(void)initilization
{
    
    
    self.automaticallyAdjustsScrollViewInsets = NO;

    if (@available(iOS 11.0, *)) {
         self.baseTable.contentInset = UIEdgeInsetsMake(-GY_Nav_height, 0, 0, 0);
    }
    self.baseTable.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    self.baseTable.separatorColor=RGBACOLOR(240, 240, 240, 1);
    self.baseTable.showsVerticalScrollIndicator=NO;
    self.navigationController.navigationBar.shadowImage = [UIImage new];
    [self.view addSubview:self.baseTable];
    [self.baseTable setBackgroundColor:[UIColor whiteColor]];
    self.baseTable.height=self.view.height-49;
    self.baseTable.y=-1;
    [self.baseTable registerNib:[UINib nibWithNibName:@"NNSaleListCell" bundle:nil] forCellReuseIdentifier:@"NNSaleListCell"];

    self.baseTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        [self loadData];
    }];
    
    [self loadTitleV];
    [self loadData];
}
-(void)loadTitleV
{
    
    UIView *titleV = [[UIView alloc]init];
    [titleV setFrame:CGRectMake(0, 0, WF_UI_VIEW_WIDTH, 44)];
    [titleV setBackgroundColor:[UIColor clearColor]];
    @WeakSelf;
    UIImageView *searchv = [[UIImageView alloc]init];
    [searchv setFrame:CGRectMake(10, 5, WF_UI_VIEW_WIDTH - 20, 30)];
    searchv.image=[WFFunctions WFUICreateImageWithColor:RGBACOLOR(255, 255, 255, 1)];
   // [searchv addTarget:self action:@selector(toSearch:)];
    [titleV addSubview:searchv];
    [searchv addTapGestureRecognizerWithDelegate:self Block:^(NSInteger tag) {
        GYSearchVC* gy=[[GYSearchVC alloc] init];
        [selfp.navigationController pushViewController:gy animated:YES];
    }];
    [WFFunctions WFUIaddbordertoView:searchv radius:15 width:0.0f color:nil];
    
    btnrr = [[UIButton alloc]init];
    btnrr.frame=CGRectMake(WF_UI_VIEW_WIDTH - 70, 5, 70, 30);
    [btnrr setTitle:@"搜索" forState:UIControlStateNormal];
    [btnrr setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    btnrr.titleLabel.font=SYSTEMFONT(15);
   // [titleV addSubview:btnrr];
    
    
    [btnrr handleControlEvent:UIControlEventTouchUpInside withBlock:^{

        GYSearchVC* gy=[[GYSearchVC alloc] init];
        [selfp.navigationController pushViewController:gy animated:YES];
    }];
    
    
    
    UIImageView* locationIV=[[UIImageView alloc] init];
    locationIV.image=[UIImage imageNamed:@"home_search"];
    locationIV.x=12;
    locationIV.y=7;
    locationIV.width=locationIV.image.size.width;
    locationIV.height=locationIV.image.size.height;
    [searchv addSubview:locationIV];
    
    UILabel*  titleLab=[[UILabel alloc] init];
    titleLab.x=WFCGFloatX(40);
    titleLab.y=WFCGFloatY(0);
    titleLab.width=WFCGFloatX(150);
    titleLab.height=30;
    titleLab.font=SYSTEMFONT(12);
    titleLab.textColor=HEXCOLOR(@"#999999");
    titleLab.text=@"搜索你感兴趣的内容";
    [searchv addSubview:titleLab];
    
    
    [self.navigationController.navigationBar addSubview:titleV];
}
-(void)viewModelBand
{
    @WeakSelf;
    GCBaseObservationModel* saleOber=[GCBaseObservationModel new];
    saleOber.keyPath=@"datas";
    saleOber.observation=self.saleViewModel;
    saleOber.handler = ^(NSString *keyPath) {
        [selfp.baseTable reloadData];
    };
    [self registObservation:saleOber];
    
    
    GCBaseObservationModel* buyOber=[GCBaseObservationModel new];
    buyOber.keyPath=@"datas";
    buyOber.observation=self.buyViewModel;
    buyOber.handler = ^(NSString *keyPath) {
        [selfp.baseTable reloadData];
    };
    [self registObservation:buyOber];
    
    GCBaseObservationModel* marketOber=[GCBaseObservationModel new];
    marketOber.keyPath=@"datas";
    marketOber.observation=self.marketViewModel;
    marketOber.handler = ^(NSString *keyPath) {
        [selfp.baseTable reloadData];
    };
    [self registObservation:marketOber];
    
    GCBaseObservationModel* topOber=[GCBaseObservationModel new];
    topOber.keyPath=@"marketPriceArr";
    topOber.observation=self.marketViewModel;
    topOber.handler = ^(NSString *keyPath) {
        [selfp.baseTable reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
    };
    [self registObservation:topOber];
    
    GCBaseObservationModel* topSecOber=[GCBaseObservationModel new];
    topSecOber.keyPath=@"bannerArr";
    topSecOber.observation=self.topViewModel;
    topSecOber.handler = ^(NSString *keyPath) {
        [selfp.baseTable reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
    };
    [self registObservation:topSecOber];
    
    GCBaseObservationModel* addSecOber=[GCBaseObservationModel new];
    addSecOber.keyPath=@"addArr";
    addSecOber.observation=self.adViewModel;
    addSecOber.handler = ^(NSString *keyPath) {
        [selfp.baseTable reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];
    };
    [self registObservation:addSecOber];
    
    
    
    
    
    
    GCBaseObservationModel* ppptypeObj=[GCBaseObservationModel new];
    ppptypeObj.keyPath=@"datas";
    ppptypeObj.observation=self.typeViewModel;
    ppptypeObj.handler = ^(NSString *keyPath) {
        if (selfp.typeViewModel.datas.count<=2) {
            selfp.typeCollectView.height=WFCGFloatY(200);
        }else
        {
            NSInteger count= (selfp.typeViewModel.datas.count-2)%3==0?(selfp.typeViewModel.datas.count-2)/3:(selfp.typeViewModel.datas.count-2)/3+1;
            selfp.typeCollectView.height=WFCGFloatY(200)+count*WFCGFloatY(146);
        }
        selfp.typeCollectView.dataSource=selfp.typeViewModel.datas;
        [self.typeCollectView layoutSubviews];
        [selfp.baseTable reloadData];
        
    };
    [self registObservation:ppptypeObj];
}

-(void)loadData
{
    NSMutableDictionary* dic=[[NSMutableDictionary alloc] init];
    [dic setObject:@"31" forKey:@"type"];
    [self.saleViewModel requestDatas:dic];
    [self.buyViewModel requestDatas:[NSMutableDictionary new]];
    if ([[GYLoginViewModel shareInterface] roleType]==1)
    {
        
    }


    
    dic[@"ecommend"]=@"1";
    dic[@"type"]=@"3_2";
    [self.marketViewModel requestDatas:dic];
    
    NSMutableDictionary* mDic=[NSMutableDictionary new];
    mDic[@"lx"]=@"2";
    mDic[@"type"]=@"2_A";
    [self.topViewModel requestMarket:nil];

    [self.topViewModel requestAd:mDic];
    
    mDic[@"type"]=@"2_K";
    [self.adViewModel requestAd:mDic];
    
    [self.typeViewModel requestDatas:nil];
    

}
#pragma mark - life
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.isGroup=YES;
    [self viewModelBand];
    [self initilization];
    self.title=@"";
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController.navigationBar lt_reset];
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    [self.navigationController.navigationBar lt_reset];
}
-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    float floatY=self.baseTable.contentOffset.y;
    float myAlpha= floatY/GY_Nav_height;
    if (myAlpha>=1)
    {
        myAlpha=1;
        [UIApplication sharedApplication].statusBarStyle =  UIStatusBarStyleLightContent;
    }else
    {
        [UIApplication sharedApplication].statusBarStyle =  UIStatusBarStyleDefault;
    }
    [self.navigationController.navigationBar lt_setBackgroundColor:[RGBACOLOR(184,26,8,1) colorWithAlphaComponent:myAlpha]];
}
#pragma mark - delegate
#pragma mark - table delegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{

    return 4;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section==1) {
        return 1;
       // return self.saleViewModel.datas.count;
    }
    if (section==3) {
        if (self.buyViewModel.datas.count>3) {
            return 3;
        }
        return self.buyViewModel.datas.count;
    }
    if (section==2) {
        if (self.saleViewModel.datas.count>3) {
            return 3;
        }
        return self.saleViewModel.datas.count;
    }
    if (section==0) {
        return 1;
    }
    
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==2)
    {
        NSString *cellIdentifier = @"NNSaleListCell";
        NNSaleListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        GYHomeBuyProductInfoModel *model = self.saleViewModel.datas[indexPath.row];

        [cell.coverIV sd_setImageWithURL:[NSURL URLWithString:model.imgpath]];
        cell.nameLab.text=model.name;
        cell.priceLab.text=[NSString stringWithFormat:@"¥%@",model.price];
        cell.markLab.text=@"哈哈哈哈哈";
        cell.addressLab.text=@"山东济南";
        
        return cell;

    }
    
    if (indexPath.section==3)
    {
        static NSString *CellID = @"CellIDThird";
        GYBuyListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
        if (cell == nil) {
            cell = [[GYBuyListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        GYHomeBuyProductInfoModel *model = self.buyViewModel.datas[indexPath.row];
        cell.model = model;

        if ([[GYLoginViewModel shareInterface] roleType]==1)
        {
            @WeakSelf;
            [cell.offerBtn handleControlEvent:UIControlEventTouchUpInside withBlock:^{
                GYHomeBuyDetailVC* gy=[[GYHomeBuyDetailVC alloc] init];
                gy.passModel=model;
                gy.passID=[NSString stringWithFormat:@"%@",model.id];
                [selfp.navigationController pushViewController:gy animated:YES];
                
            }];
        }else
        {
            [cell.offerBtn setHidden:YES];
        }
        return cell;
    }
    
    if (indexPath.section==1)
    {
        static NSString *CellID = @"CellID";
        UITableViewCell* cell=[tableView dequeueReusableCellWithIdentifier:CellID];
        if (!cell) {
            cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellID];
            cell.selectionStyle=UITableViewCellSelectionStyleNone;
            cell.backgroundColor=HEXCOLOR(@"#F7F7F7");
        }
        
        [cell.contentView removeAllSubviews];

        SDCycleScrollView* bannerScroll=[SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(WFCGFloatX(9), 0, WFCGFloatX(375-18), WFCGFloatY(107)) delegate:self placeholderImage:DefaultImage];
        bannerScroll.backgroundColor=Main_Color_BGLightGray;
        bannerScroll.currentPageDotColor=[UIColor whiteColor];
        bannerScroll.pageDotColor=RGBACOLOR(216, 216, 216, 0.5);
        bannerScroll.pageControlBottomOffset=5;
        [cell.contentView addSubview:bannerScroll];
        NSMutableArray* imageArr=[[NSMutableArray alloc] init];
        if (self.adViewModel.addArr.count==0)
        {
            bannerScroll.localizationImageNamesGroup=@[@"home_ad_default"];
        }else
        {
            for (GYAdModel*mode in self.adViewModel.addArr)
            {//kBannerImgSuffix
                [imageArr addObject:[NSString stringWithFormat:@"%@%@",mode.imgurl,kProductImgOriginSuffix]];
            }
            bannerScroll.imageURLStringsGroup=imageArr;
        }
        return cell;
    }

    if (indexPath.section==0)
    {
        static NSString* identify=@"firstPhonecell";
        GYHomeTopCell* cell=[tableView dequeueReusableCellWithIdentifier:identify];
        if (!cell) {
            cell=[[GYHomeTopCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identify];
            cell.selectionStyle=UITableViewCellSelectionStyleNone;
            cell.backgroundColor=HEXCOLOR(@"#F7F7F7");
        }
        @WeakSelf;
        cell.MarketArr=self.topViewModel.marketPriceArr;
        cell.BnnerArr=self.topViewModel.bannerArr;
        cell.cellback = ^(NSString *str, NSInteger type) {
            [selfp pushVC:str type:type];
        };
        return cell;
    }
    
    static NSString* identify=@"threePhonecell";
    UITableViewCell* cell=[tableView dequeueReusableCellWithIdentifier:identify];
    if (!cell) {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identify];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
        cell.backgroundColor=[UIColor whiteColor];
    }
    [cell.contentView removeAllSubviews];
    [cell.contentView addSubview:self.typeCollectView];
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==0) {
        return WFCGFloatY(435)-90;
    }
    if (indexPath.section==2) {
        return WFCGFloatY(110);
    }
    if (indexPath.section==3) {
        return WFCGFloatY(110);
    }
    if (indexPath.section==4) {
        return WFCGFloatY(134);
    }

    return WFCGFloatY(107);
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView* view=[[UIView alloc] init];
    view.backgroundColor=[UIColor whiteColor];
    if (section==3||section==2)
    {
        NSArray* imageA=@[@"header_btn_1",@"header_btn_2",@"header_btn_3",@"header_btn_4",@"header_btn_5"];
        NSArray* titleArr=@[@"现货资源",@"求购信息",@"行情中心",@"革优物流",@"革优仓储"];
        view.backgroundColor=[UIColor whiteColor];
        UIImageView* leftIV=[[UIImageView alloc]init];
        leftIV.image=[UIImage imageNamed:imageA[section-2]];
        leftIV.frame=WFCGRectMake(8, (52-leftIV.image.size.height)/2, leftIV.image.size.width, leftIV.image.size.height);
        [view addSubview:leftIV];

        UILabel* titleLab=[[UILabel alloc] init];
        titleLab.textColor=Main_Color_Black;
        titleLab.font=SYSTEMFONT(18);
        titleLab.frame=WFCGRectMake(36, 0, 100, 52);
        titleLab.text=titleArr[section-2];
        [view addSubview:titleLab];
        
        UIButton* btn=[UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame=WFCGRectMake(375-50, 0, 50, 52);
        [btn setTitle:@"更多" forState:UIControlStateNormal];
        [btn setTitleColor:Main_Color_LightGray forState:UIControlStateNormal];
        btn.titleLabel.font=SYSTEMFONT(13);
        [view addSubview:btn];
        btn.tag=section;
        [btn addTarget:self action:@selector(moreBtnPress:) forControlEvents:UIControlEventTouchUpInside];
        

        CALayer* line=[[CALayer alloc] init];
        line.frame=WFCGRectMake(0, 51, 375, 0.5);
        line.backgroundColor=Main_Color_BGLightGray.CGColor;
        [view.layer addSublayer:line];
    }
    
    return view;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section==0||section==1) {
        return .0001f;
    }
    return WFCGFloatY(52);
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView* view=[UIView new];
    view.backgroundColor=Main_Color_BGLightGray;
    if (section==2) {
        view.backgroundColor=[UIColor whiteColor];
    }
    return view;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    if (section==4) {
        return .001f;
    }
    return 10;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==3)
    {
        GYHomeBuyProductInfoModel *model = self.buyViewModel.datas[indexPath.row];
        GYHomeBuyDetailVC* gy=[[GYHomeBuyDetailVC alloc] init];
        gy.passID=[NSString stringWithFormat:@"%@",model.id];
        gy.passModel=model;
        [self.navigationController pushViewController:gy animated:YES];
    }
    if (indexPath.section==2)
    {
        GYHomeBuyProductInfoModel *model = self.saleViewModel.datas[indexPath.row];
        GYHomeSaleDetailVC* gy=[[GYHomeSaleDetailVC alloc] init];
        gy.passID=model.shopid;
        gy.hidesBottomBarWhenPushed=YES;
        [self.navigationController pushViewController:gy animated:YES];
    }
}
#pragma scrolldelegate

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    
    float floatY=scrollView.contentOffset.y;
    float myAlpha= floatY/GY_Nav_height;
    if (scrollView==self.baseTable)
    {
        [self.navigationController.navigationBar lt_setBackgroundColor:[RGBACOLOR(184,26,8,1) colorWithAlphaComponent:myAlpha]];
        if (myAlpha>=1)
        {
            [UIApplication sharedApplication].statusBarStyle =  UIStatusBarStyleLightContent;
        }else
        {
            [UIApplication sharedApplication].statusBarStyle =  UIStatusBarStyleDefault;
        }
    }
}
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    if (self.adViewModel.addArr.count>0)
    {
        GYAdModel* model=self.adViewModel.addArr[index];
        GCBaseWebVC* gy=[[GCBaseWebVC alloc] init];
        gy.information=@{@"url":model.url};
        [self.navigationController pushViewController:gy animated:YES];
    }
}
@end

/*
 11111111111111111111111111111111111111001111111111111111111111111
 11111111111111111111111111111111111100011111111111111111111111111
 11111111111111111111111111111111100001111111111111111111111111111
 11111111111111111111111111111110000111111111111111111111111111111
 11111111111111111111111111111000000111111111111111111111111111111
 11111111111111111111111111100000011110001100000000000000011111111
 11111111111111111100000000000000000000000000000000011111111111111
 11111111111111110111000000000000000000000000000011111111111111111
 11111111111111111111111000000000000000000000000000000000111111111
 11111111111111111110000000000000000000000000000000111111111111111
 11111111111111111100011100000000000000000000000000000111111111111
 11111111111111100000110000000000011000000000000000000011111111111
 11111111111111000000000000000100111100000000000001100000111111111
 11111111110000000000000000001110111110000000000000111000011111111
 11111111000000000000000000011111111100000000000000011110001111111
 11111110000000011111111111111111111100000000000000001111100111111
 11111111000001111111111111111111110000000000000000001111111111111
 11111111110111111111111111111100000000000000000000000111111111111
 11111111111111110000000000000000000000000000000000000111111111111
 11111111111111111100000000000000000000000000001100000111111111111
 11111111111111000000000000000000000000000000111100000111111111111
 11111111111000000000000000000000000000000001111110000111111111111
 11111111100000000000000000000000000000001111111110000111111111111
 11111110000000000000000000000000000000111111111110000111111111111
 11111100000000000000000001110000001111111111111110001111111111111
 11111000000000000000011111111111111111111111111110011111111111111
 11110000000000000001111111111111111100111111111111111111111111111
 11100000000000000011111111111111111111100001111111111111111111111
 11100000000001000111111111111111111111111000001111111111111111111
 11000000000001100111111111111111111111111110000000111111111111111
 11000000000000111011111111111100011111000011100000001111111111111
 11000000000000011111111111111111000111110000000000000011111111111
 11000000000000000011111111111111000000000000000000000000111111111
 11001000000000000000001111111110000000000000000000000000001111111
 11100110000000000001111111110000000000000000111000000000000111111
 11110110000000000000000000000000000000000111111111110000000011111
 11111110000000000000000000000000000000001111111111111100000001111
 11111110000010000000000000000001100000000111011111111110000001111
 11111111000111110000000000000111110000000000111111111110110000111
 11111110001111111100010000000001111100000111111111111111110000111
 11111110001111111111111110000000111111100000000111111111111000111
 11111111001111111111111111111000000111111111111111111111111100011
 11111111101111111111111111111110000111111111111111111111111001111
 11111111111111111111111111111110001111111111111111111111100111111
 11111111111111111111111111111111001111111111111111111111001111111
 11111111111111111111111111111111100111111111111111111111111111111
 11111111111111111111111111111111110111111111111111111111111111111
 
 
 */
